//
//  UIScrollView+BCYRefresh.m
//  Refresh
//
//  Created by ning liu on 2018/3/13.
//  Copyright © 2018年 ning liu. All rights reserved.
//

#import "UIScrollView+BCYRefresh.h"
#import "KafkaRefresh.h"
#import "RefreshRingHeader.h"


@implementation UIScrollView (BCYRefresh)

-(void)addHeaderByRefreshHandler:(void(^)(void))handler
{
    RefreshRingHeader *control = [[RefreshRingHeader alloc]init];
    self.headRefreshControl = control;
    control.refreshHandler = handler;
}

-(void)addFooterByRefreshHandler:(void(^)(void))handler
{
    [self bindDefaultRefreshStyleAtPosition:KafkaRefreshPositionFooter refreshHanler:handler];
}


-(void)endRefreshing
{
    //结束下拉刷新
    [self.headRefreshControl endRefreshing];
    
    //结束分页
    [self.footRefreshControl endRefreshing];
    
//     [self.footRefreshControl endRefreshingAndNoLongerRefreshingWithAlertText:@"已经到底了"];
    
}

-(void)setLoadEnd
{
    
}

-(BOOL)isLoading
{
    return self.headRefreshControl.isRefresh;
}


@end
